﻿using System;

namespace Kise.LprCapturer
{
    public class Frame
    {
        public CapturedImage[] Images { get; set; }      //jpeg格式的图片
        public byte[] H264 { get; set; }
        public string[] PlateNumbers { get; set; }  //包含的车牌号码
        public DateTime CaptureTime { get; set; }   //抓拍时间
        public string LocationId { get; set; }
        public int RoadNo { get; set; }
        public int Speed { get; set; }
        public int SpeedLimit { get; set; }

        public H264Frame ToH264Frame()
        {
            var h264 = new H264Frame();
            h264.CaptureTime = this.CaptureTime;
            h264.LocationId = this.LocationId;
            h264.RoadNo = this.RoadNo;
            h264.H264 = this.H264;

            return h264;
        }

        public int ViolationType //违法类型
        {
            get { return Speed > SpeedLimit ? 5 : 0; }
        }
    }


    public class H264Frame
    {
        public byte[] H264 { get; set; }
        public DateTime CaptureTime { get; set; }   //抓拍时间
        public string LocationId { get; set; }
        public int RoadNo { get; set; }
    }


    public class CapturedImage
    {

        public DateTime CaptureTime { get; private set; }
        public byte[] JpegBuffer { get; private set; }

        public CapturedImage(DateTime captureTime, byte[] jpegBuffer)
        {
            CaptureTime = captureTime;
            JpegBuffer = jpegBuffer;
        }
    }
}
